// Copyright 2019 orivil.com. All rights reserved.
// Use of this source code is governed by a MIT-style
// license that can be found at https://mit-license.org.

package main

import (
	"gitee.com/orivil/morgine/bundles/admin"
	"gitee.com/orivil/morgine/log"
	"gitee.com/orivil/morgine/service"
	"gitee.com/orivil/morgine/xinit"
	"gitee.com/orivil/morgine/xx"
	"gitee.com/orivil/morgine/xx/middles"
	"gitee.com/tugoer/psy-testing/code"
)

func main() {
	xinit.Initializer.Listen(xinit.AddRoutes, func(container *service.Container) error {
		xx.Use(middles.Logger, nil)
		xx.AllowAllCrossSiteAccess(middles.AllowCrossSite)
		xx.DisallowedAllSpiders()
		xx.HandleTotalApi("/api-data")
		return nil
	})
	admin.XInit()
	code.XInit()
	xinit.TriggerInitializer(func(err error) {
		log.Warning.Println(err)
	})
	xx.Run()
}
